package app.fugema.shop.main.order.adapter;

import android.view.View;

import androidx.lifecycle.LifecycleOwner;

import com.base.common.view.adapter.ada.GeneralRecyclerAdapter;
import com.base.common.view.adapter.connector.BaseItemTypeInterface;
import com.base.common.view.adapter.connector.BaseUniversalItemMultiType;
import app.fugema.shop.R;
import app.fugema.shop.main.order.model.OrderExpressResult;
import app.fugema.shop.main.order.model.OrderDetailFooterBean;
import app.fugema.shop.main.order.view.DeliveryCheckDetailActivity;
import app.fugema.shop.main.order.vm.OrderListVM;

public class OrderDetailAdapter extends GeneralRecyclerAdapter {

    private OrderListVM orderListVM;

    public OrderDetailAdapter(LifecycleOwner lifecycleOwner, OrderListVM orderListVM) {
        this.lifecycleOwner = lifecycleOwner;
        this.orderListVM = orderListVM;
        init();
    }

    @Override
    public void initMultiItemType()
    {
        //物流信息
        putMultiItemType(new BaseUniversalItemMultiType<OrderExpressResult>(R.layout.shopping_delivery_check_item) {
            @Override
            public int getItemViewType() {
                return TYPE_HEAD_ONE;
            }

            @Override
            public void onItemClick(View view, int onclickType, int position, OrderExpressResult bean) {
                super.onItemClick(view, onclickType, position, bean);
                DeliveryCheckDetailActivity.start(view.getContext(), bean.getOrderId());
            }
        });
        putMultiItemType(new OrderAddrMultiType());
        putMultiItemType(new OrderDetailGoodsItemMultiType(lifecycleOwner, orderListVM));
        //订单时间支付方式
        putMultiItemType(new OrderFooterMultiType());
        //联系方式
        putMultiItemType(new BaseUniversalItemMultiType<OrderDetailFooterBean>(R.layout.order_detail_info_footer)
        {
            @Override
            public int getItemViewType()
            {
                return BaseItemTypeInterface.TYPE_FOOT_ONE;
            }
        });
    }


}
